/**
 * Created by rh on 2017/8/15.
 */
//图片或视频比例通屏方法调用
function ban_s(obj) {
  var pic_t = 750 / 370;
  var imgWidth = $(window).width();
  var imgHeight = imgWidth / pic_t;
  $(obj).css({"width": imgWidth, "height": imgHeight});
}

/*关闭底部*/
function colseTan(){
  $(".pdDownLoad").hide();
}

//点击播放
function videoPlay(id) {
  var $video = document.getElementById(id);
  $(".iconFont").hide(100);
  $video.play();
}

/*监听视频状态*/
function getVideo() {
  var myVideo = document.getElementById("video");
  myVideo.addEventListener('play', function () {
    $('.iconFont').hide(100);
  });
  myVideo.addEventListener('pause', function () {
    $('.iconFont').show(100);
  });
}

let ifClick = false;
/*图片放大*/
function scaleFun(obj,e,num){
  e.stopPropagation();
  $(obj).css({'height':28+'rem'});
  let height ='';
  if(num==1){
    height = $(obj).height()/2/8;
  }else{
    height = $(obj).height()/2/3;
  }

  if(ifClick==false){
    $('.imgBg').show();
    $(obj).css({"marginTop":-14+"rem"});
    $(obj).parent().addClass('onScale');
    ifClick = true;
    var scrollTop = window.pageYOffset
        || document.documentElement.scrollTop
        || document.body.scrollTop
        || 0;
    sss=scrollTop;//保存当前滚动条位置
    document.body.style.top=-1*scrollTop+"px";
    document.body.style.position='fixed';

  }else{
    ifClick = false;
    $('.imgBg').hide();
    $(obj).parent().removeClass('onScale');
    $(obj).parent().find('img').css({"marginTop":""});

    if(num!=1){
      $(obj).parent().find('img').css({'height':8+'rem'});
    }else{
      $(obj).parent().find('img').css({'height':'auto'});
    }

    document.body.style.overflow='';
    document.body.style.position=null;
    document.body.style.top=null;
    window.scrollTo(0,sss);

  }
}


function scalsClose(obj,num){

  ifClick = false;
  $('.imgBg').hide();
  $(obj).removeClass('onScale');
  $(obj).find('img').css({"marginTop":""});

  if(num!=1){
    $(obj).find('img').css({'height':8+'rem'});
  }else{
    $(obj).find('img').css({'height':'auto'});
  }

  document.body.style.overflow='';
  document.body.style.position=null;
  document.body.style.top=null;
  window.scrollTo(0,sss);


}

